package game.views;

import game.data.IRoleData;
import hx.display.UILoadScene;

/**
 * 技能描述界面
 */
@:build(hx.macro.UIBuilder.build("assets/views/SkillDescView.xml"))
class SkillDescView extends UILoadScene {
	public var p1:IRoleData;

	public var p2:IRoleData;

	public function new(p1:IRoleData, p2:IRoleData) {
		super();
		this.p1 = p1;
		this.p2 = p2;
	}

	override function onLoaded() {
		super.onLoaded();
		for (data in p1.actions) {
			if (data.groupKeys == null || data.groupKeys.length == 0)
				continue;
			var skillItem = new SkillDescItem(data);
			this.p1czb.addChild(skillItem);
		}
		for (data in p2.actions) {
			if (data.groupKeys == null || data.groupKeys.length == 0)
				continue;
			var skillItem = new SkillDescItem(data);
			this.p2czb.addChild(skillItem);
		}
		this.close.clickEvent = () -> {
			this.releaseScene();
		}
	}
}
